{include file='common/header'}

<style>
    .friend_area{ text-align: left; width: 300px; margin: 0 auto; height: 220px; overflow-y: scroll;
        overflow-x: hidden; }
    .friend_area li{ display: inline-block; width: 50px; height: 65px; padding: 5px; font-size: 14px; color: #666;
        text-align: center; background: white; }
    .name{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .head{ height: 50px; width: 50px; }
    .friend_area li img{ width: 100%; height: 100%; }
    input[type=checkbox]{ position: relative; top: 2px; }
    .notice{ width: 300px; margin: 0 auto; height: 25px; line-height: 25px; }
</style>

<div class="content">

    <div class="panel">
        <div class="logo"></div>
        <div class="sign">
            <h2>创建聊天室</h2>
            <form id="login_form">
                <input type="text" name="name" placeholder="群组名" />
                <input type="text" name="num" placeholder="最大用户数" value="5000" />
                <textarea name="desc" placeholder="简介" ></textarea>
                <input type="button" class="btn_info" name="post" value="提交" />
            </form>
        </div>
    </div>

</div>

{include file='common/footer'}

<script language="JavaScript">

    //创建聊天室
    $('input[name=post]').click(function(){
        var name = $('input[name=name]').val();
        var num = $('input[name=num]').val();
        var desc = $('textarea[name=desc]').val();
        if(name.length <= 0){
            return layer.alert('房间名不能为空.', {icon:2});
        }
        if(num <= 0){
            return layer.alert('聊天室人数不能小于0.', {icon:2});
        }
        var data = parent.Im.data;
        var r_index = layer.load();
        parent.Im.request('room/createRoomChat', {username:data.username,
            groupid:data.groupid, roomname:name, roomdesc:desc, maxusers:num}, function(res){
            layer.close(r_index);
            if(res.code == 1){
                parent.location.reload();
            }else{
                layer.msg(res.msg);
            }
        });
    });
</script>